from sqlalchemy.dialects.mysql import INTEGER, VARCHAR,FLOAT
from sqlalchemy import Column
from sqlalchemy.ext.declarative import declarative_base

from pydantic import BaseModel, ValidationError, validator
Base = declarative_base()


# tunnel_sensor_original_data表结构
class Equipment(Base):
    __tablename__ = 'equipment'

    id = Column(INTEGER, primary_key=True)
    type_id = Column(INTEGER, default=0)
    number = Column(VARCHAR(256), default='', nullable=False)
    work_face_width = Column(FLOAT, default=0, nullable=False)
    work_face_height = Column(FLOAT, default=0, nullable=False)
    work_face_distance = Column(FLOAT, default=0, nullable=False)
    max_stress = Column(FLOAT, default=0, nullable=False)
    min_stress = Column(FLOAT, default=0, nullable=False)
    modulus = Column(FLOAT, default=0, nullable=False)
    poisson = Column(FLOAT, default=0, nullable=False)
    vertical_threshold = Column(FLOAT, default=0, nullable=False)
    coal_thickness = Column(FLOAT, default=0, nullable=False)
    update_time = Column(INTEGER, default=0)
    create_time = Column(INTEGER, default=0)


class Item(BaseModel):
    number:str
    work_face_width: float
    work_face_height: float
    vertical_threshold: float
    work_face_distance: float
    coal_thickness: float

class UpdateInfo(BaseModel):
    equipment_id:int
    number:str
    work_face_width: float
    work_face_height: float
    vertical_threshold: float
    work_face_distance: float
    coal_thickness: float
